package designPatterns.P08_组合模式_Composite.P01_employee;

public class P01 {
    public static void main(String[] args) {
        Employee CEO = new Employee("John", "CEO", 30000);
        Employee headSales = new Employee("Robert", "sales", 20000);
        Employee saleExecutive1 = new Employee("Richard", "sales", 10000);
        Employee saleExecutive2 = new Employee("Bob", "sales", 10000);
        CEO.add(headSales);
        headSales.add(saleExecutive1);
        headSales.add(saleExecutive2);

        System.out.println(CEO);
        for (Employee sub1 : CEO.getSubordinates()) {
            System.out.println(sub1);
            for (Employee sub2 : sub1.getSubordinates()) {
                System.out.println(sub2);
            }
        }
    }
}
